package com.ruoyi.system.api;

import com.ruoyi.common.core.constant.SecurityConstants;
import com.ruoyi.common.core.constant.ServiceNameConstants;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.system.api.domain.BankUser;
import com.ruoyi.system.api.domain.SysUser;
import com.ruoyi.system.api.factory.RemoteBankUserFallbackFactory;
import com.ruoyi.system.api.factory.RemoteUserFallbackFactory;
import com.ruoyi.system.api.model.LoginUser;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

@FeignClient(contextId = "remoteBankUserService", value = ServiceNameConstants.BANK_SERVICE, fallbackFactory = RemoteBankUserFallbackFactory.class)
public interface RemoteBankUserService {
    /**
     * 通过用户名查询用户信息
     *
     * @param openId 用户名
     * @param source 请求来源
     * @return 结果
     */
    @GetMapping("/bankuser/info/{openId}")
    public R<LoginUser> getUserInfo(@PathVariable("openId") String openId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 注册用户信息
     *
     * @param user 用户信息
     * @param source 请求来源
     * @return 结果
     */
    @PostMapping("/bankuser/register")
    public R<Boolean> registerUserInfo(@RequestBody BankUser user, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

}
